<div class="box box-primary">
    <div class="box-body">
        <!-- the events -->
        <div id="external-events">
            <div class="row">
                <div class="col-xs-12">
                    <h4 class="box_content">Company : <?php echo $company_name; ?></h4>
                </div>
            </div>
            <div id="results" cellspacing="0"> 
            	 <?php
                foreach ($job_sub_categories->result() as $category) {
                    //$category_id = $category->job_sub_category_id;
                    $name = $category->name;
                    $count = $category->count;
                    $key_category = $category->job_sub_categories_keys;
                    ?>
                    <div class="col-xs-4 clear">
                        <a href="<?php echo base_url(); ?>jobs/sub-category/<?php echo $key_category; ?>" class="gray"> <?php echo $name; ?> (<span class="red"><?php echo $count; ?></span>) </a>
                    </div>
                    <?php
                }
                ?>
            </div>
            <div id="results" cellspacing="0"> 
            	<?php 
            	if ($results) {
            if ($results != null && $results->num_rows > 0) {
                foreach ($results->result() as $row) {
                    //$jobId = $row->job_ads_id;
                    $description = character_limiter($row->job_description, 170);
					
                    ?>
                    
                    <div class="list-job-white">
                    <?php
                    echo "<a class='job-load-title' href='" . base_url() . "jobs/detail/" . $row->job_keys . "'>
                    <span>" . $row->job_title . "</span></a>";
                    $exp_date = date("Y-m-d",strtotime($row->date_available)); 
                    $todays_date = date("Y-m-d"); 
                    $today = strtotime($todays_date);
                    $expiration_date = strtotime($exp_date);
                    if ($today > $expiration_date){
                    	echo "&nbsp;<span class='label label-danger'> Expired </span>";
                    }else if($today == $expiration_date){
                    	echo "&nbsp;<span class='label label-info'> Nearly Expire </span>";
                    }else if($row->is_featured_job =='YES' && $row->featured_job_status == 1){
						echo "&nbsp;<span class='label label-warning'> Ads</span>";
                    }
					
                   
                    echo "<span class='pull-right job-expire'> Avaliable on : " .  date("d-M-Y", strtotime($row->date_available)) . "</span>";
                    echo "<p> " . $row->company_name . " - " . $row->location_name; 
					if(strtotime($row->job_create_date) > strtotime("-1 day")){
						echo " - <b class='post-today'> Posted today</b>";
					}
					echo "</p>";
                    echo "<a class='btn-read-more pull-right' href='" . base_url() . "jobs/detail/" . $row->job_keys . "'>View Detail<i class='fa fa-fw fa-angle-double-right'></i></a>";

                    echo "<p>" . strip_tags($description) . "</p>";
                    echo "</div>";
                }
			echo $links; 
            } else {
                echo " <div id='contain-no-result'>
                          <h3 id='no-result'>No resutl!</h3>
                       </div>";
            }
        }
            	
            	?>
            </div>	
            <div id='loading' style="display: none;"><img src="<?php echo base_url() . F_IMG; ?>loading.gif"></div>

        </div><!-- /.box-body -->
    </div>
</div><!-- /. end facebook fan page -->